//
//  BCWNavItem.m
//  BCW
//
//  Created by Mac on 16/3/29.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "BCWNavItem.h"
#import "UIBarButtonItem+CustomItem.h"

@implementation BCWNavItem

- (instancetype)init{
    if (self = [super init]) {
        // titleView
        UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 150, 44)];
        self.titleView = titleView;
        self.titleView = titleView;
        
        UILabel *prompt = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, titleView.width, 20)];
        prompt.text = @"距离开奖剩余：";
        [titleView addSubview:prompt];
        prompt.textColor = WhiteColor;
        prompt.textAlignment = 1;
        self.promptL = prompt;
        //    prompt.centerX = titleView.centerX;
        
        UILabel *status = [[UILabel alloc] initWithFrame:CGRectMake(0, prompt.bottom + 2, 80, 20)];
        status.backgroundColor = [UIColor whiteColor];
        status.text = @"正在开奖";
        [titleView addSubview:status];
        status.textColor = ThemeColor;
        status.font = SystemFont(12);
        status.textAlignment = 1;
        status.centerX = prompt.centerX;
        self.ststusL = status;
        
        self.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"return"
                                                                    hightImage:@"return"
                                                                        target:self
                                                                        action:@selector(leftClick)];
        
        self.rightBarButtonItem = [UIBarButtonItem itemWithImage:@"share-connection"
                                                                     hightImage:@"share-connection"
                                                                         target:self
                                                                         action:@selector(rightClick)];
    }
    return self;
}

- (void)leftClick{
    if (_itemClick) {
        _itemClick(1);
    }
}

- (void)rightClick{
    if (_itemClick) {
        _itemClick(2);
    }
}
@end
